<template>
	<view class="share-page">
			<web-view :src="url"></web-view>
	</view>
</template>

<script lang="ts" setup>
	import {ref, onMounted, computed} from 'vue'
	import { homeServer} from "@/common/index"
	import { global }  from "@/utils/index"
	
	import { useStudentListStore } from "@/stores/useStudentList.js"
	const studentStore = useStudentListStore();
	const curStd = computed(() => studentStore.currentStudent);
	const shareCodeInfo =  ref({})
	
	// 获取分项码
	const  queryShareCode = async () => {
		try{
			const {data, status} = await homeServer.remainMoneyAndSharecode()
			console.log('获取分项码', data, status)
			if(status === '200'){
				shareCodeInfo.value = data
			}
		}catch(e){
			console.log(e)
			//TODO handle the exception
		}
	}
	
	onMounted(() => {
		queryShareCode()
	})
	
	
	const url = computed(() =>{
		const token = global.getToken()
		let src = ''
		if(token){
			src = `http://share.jzshzs.cn/?token=${token}&isApp=wx&shareCode=${shareCodeInfo.value?.sharecode}`
		}
		return src;
	})
		
		
</script>

<style lang="scss" scoped>
	.share-page{
		width: 100vw;
		min-height: 100vh;
		position: relative;
	}
</style>